VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "TestProjectFixture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mProject As ProjectFixture
Private mFactory As New ProjectFactory
Private mSequenceLog As String

Private mResult As New ResultPrimitive

Public Sub testProjectStatically()
givenProject
thenNameIs "prjDummyTestProject"
thenNumberOfClasses 2
thenNumberOfMethods 5
'NB the number of assert will be reported as 0
thenNumberOfAsserts 0
thenElapsedTimeIs 0

End Sub
Public Sub testProjectDynamically()
givenProject
thenNumberOfAsserts 0

whenProjectIsRun
thenNumberOfAsserts 7
thenSequenceIs "I.s.t1.t.s.t2.t.T.I.s.s.s.T"
thenElapsedTimeGt 0.000002
End Sub

''
''
Private Sub givenProject()
Set mProject = mFactory.newProjectFixture(self)
End Sub
Private Sub whenProjectIsRun()
Dim aNotifier As New MockNotifier
Dim i As init
Set i = DummyAssert
i.init mResult
mResult.setNotification aNotifier
mProject.forward aNotifier
End Sub
Private Sub thenNameIs(name As String)
assert.equals mProject.name, name
End Sub
Private Sub thenNumberOfClasses(num As Integer)
assert.equals mProject.numOfClasses, num, "Number of classes is" + Str(num)
End Sub
Private Sub thenNumberOfMethods(num As Integer)
assert.equals mProject.numOfMethods, num, "Number of methods is" + Str(num)
End Sub
Private Sub thenNumberOfAsserts(num As Integer)
assert.equals mProject.NumOfAsserts, num, "Number of asserts is" + Str(num)
End Sub
Private Sub thenSequenceIs(sequence As String)
assert.equals mSequenceLog, sequence
End Sub
Private Sub thenElapsedTimeIs(value As Double)
assert.equals mProject.elapsedTime, value, "Time is as given"
End Sub
Private Sub thenElapsedTimeGt(value As Double)
assert.isTrue mProject.elapsedTime > value, "Time is greater than" + Str(value)
End Sub

''
''


'' Logger
Public Sub Add(name As String)
If Len(mSequenceLog) = 0 Then
    mSequenceLog = name
Else
    mSequenceLog = mSequenceLog + "." + name
End If
End Sub


'OPTIONAL METHODS
Public Sub setup()
mSequenceLog = ""
prjDummyTestProject.setLogger Me
End Sub

Public Function NumOfAsserts() As Long
NumOfAsserts = 9
End Function

